package com.xmmj.common.room.dao

import androidx.room.*
import com.xmmj.common.room.entity.RecordBean

/**
 * 历史记录的工具类
 */
@Dao
interface RecordDao {
    @Insert
    suspend fun insert(vararg record: RecordBean)

    @Insert
    suspend fun insert(recordList: List<RecordBean>)

    @Delete
    suspend fun delete(vararg record: RecordBean): Int

    @Delete
    suspend fun delete(recordList: List<RecordBean>): Int

    @Update
    suspend fun update(vararg record: RecordBean): Int

    @Update
    suspend fun update(recordList: List<RecordBean>): Int

    @Query("SELECT * FROM record ORDER BY city ASC")
    suspend fun searchAll(): List<RecordBean>

    @Query("SELECT * FROM record WHERE city =:city")
    suspend fun searchByCityName(city: String): List<RecordBean>

    @Query("DELETE FROM record")
    suspend fun deleteAll()
}